<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JS动态时间展示(兼容IE/FIREFOX)</title>
</head>

<script type="text/javascript">
function startTime(){   
	var today=new Date();   
	var years=today.getFullYear();   
	var months=today.getMonth();   
	var d=today.getDate();   
	var h=today.getHours();   
	var m=today.getMinutes();   
	var s=today.getSeconds();
	
 // add a zero in front of numbers<10   
	months=months+1;   
	months=checkTime(months);   
	d=checkTime(d);   
 	m=checkTime(m);   
 	s=checkTime(s);   
 	
 	var weekday=new Array(7);   
 	weekday[0]="星期日";   
 	weekday[1]="星期一"; 
 	weekday[2]="星期二";   
 	weekday[3]="星期三";   
 	weekday[4]="星期四";   
 	weekday[5]="星期五";   
 	weekday[6]="星期六";   
 	
 	var w=weekday[today.getDay()];   
 	document.getElementById('ShowTime').innerHTML=years+"年"+months+"月"+d+"日 "+w+" "+h+":"+m+":"+s;   
 	setTimeout(startTime, 500);
 } 

 function checkTime(i)   
 {   
 		if(i<10){  
  			i="0" + i;  
 		}   
   return i;   
 }   
  -->  
 </script>

<body onload="startTime();">
	<div id="ShowTime"></div>

</body>
</html>